<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>CS</title>
<link rel="stylesheet" href="../../../../script/jx/cs.css">
<style media="screen">
    #rcs-app{
        box-sizing: border-box;
        padding: 1.5rem 0 0 0
    }
</style>
</head>
<body>

<div id="rcs-app"></div>


<!-- 可以将 SDK 下载到本地 配置 gruntfile 与 cs.js 合并压缩成一个 js 文件 -->
<script type="text/javascript" src="../../../../script/api.js"></script>
<script src="../../../../script/jx/RongIMLib-cs.min.js"></script>

<script src="../../../../script/jx/RongIMemoji.js"></script>
<script src="https://cdn.ronghub.com/RongIMVoice-2.2.4.min.js"></script>

<!-- <script src="../../../../script/jx/utils.js"></script>
<script src="../../../../script/jx/qiniu-upload.js"></script>

<script src="../../../../script/jx/template.js"></script>
<script src="../../../../script/jx/emoji.js"></script>
<script src="../../../../script/jx/phiz.js"></script> -->
<script src="../../../../script/jx/cs.min.js"></script>
<script>
apiready = function() {
    var token = $api.getStorage('rong_token');
    var user_info =  $api.getStorage('user_info');
    console.log(token)
    RCS.init({
        appKey: "n19jmcy5n87b9",
        token: token,
        target: document.getElementById('rcs-app'),
        customerServiceId: "service", // 客服Id
        upload: {
            fileServer: "http://upload.qiniu.com",// 文件服务器地址
            isPrivate: false // 是否是私有云
        },
        userIcon: '../../../../image/cart_off.png',//用户默认头像，在用户没有头像的时候显示
        csIcon: 'http://fsprodrcx.cn.ronghub.com/UQRxDVEHcD6_gHENUQRxDUs9XOZRBH25PGECfjBjFA/base64.png',//客服默认头像，在客服没有头像的时候显示,建议线上地址
        showButton: false,
        //是否需要按钮主动发起，设为false的时候，init()方法直接唤起聊天窗口,需客户自己编写按钮，点击之后调用init(),templates中的button模板不可用;设为true的时候，init()首先唤起客服咨询按钮，点击之后才连接客服，唤起聊天窗口，在进入页面之后就需调用init()方法。此参数是为了方便客户在点击客服按钮后自行获取token，在获取到token之后，执行init()即可。
        connectingCallback: function(){
            console.log('连接中');
        },//连接中的执行的方法，例如显示加载页面,可不传
        connectedCallback: function(){

        },//连接成功之后的方法，例如关闭加载页面,可不传
        disconnectedCallback: function(){
            alert('连接断开');
            // console.log(111)
            api.closeWin({});
        },//断开连接之后的操作,可不传
        templates: {
            button: ['<div class="rongcloud-consult">',
                    '   <button onclick="RCS.showCommon()"><span>客服咨询</span></button>',
                    '</div>',
                    '<div class="customer-service" style="display: none;"></div>'].join('')//"templates/button.html",
            // chat: "templates/chat.html",
            // closebefore: 'templates/closebefore.html',
            // conversation: 'templates/conversation.html',
            // endconversation: 'templates/endconversation.html',
            // evaluate: 'templates/evaluate.html',
            // imageView: 'templates/imageView.html',
            // leaveword: 'templates/leaveword.html',
            // main: 'templates/main.html',
            // message: 'templates/message.html',
            // messageTemplate: 'templates/messageTemplate.html',
            // userInfo: 'templates/userInfo.html',
        },
        extraInfo: {
            // 当前登陆用户信息
            userInfo: {
                name: "游客",
                grade: "VIP"
            },
            // 产品信息
            requestInfo: {
                productId: "123",
                referrer: "10001",
                define: "1" // 自定义信息
            }
        }
    });
}
</script>
</body>
</html>
